package com.atguigu.fruit.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.fruit.pojo.Fruit;
import com.atguigu.fruit.service.FruitService;
import com.atguigu.fruit.mapper.FruitMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.print.Book;
import java.util.List;

/**
* @author Administrator
* @description 针对表【t_fruit】的数据库操作Service实现
* @createDate 2022-04-29 17:48:51
*/
@Service
public class FruitServiceImpl extends ServiceImpl<FruitMapper, Fruit>
    implements FruitService{

    @Autowired
    private FruitMapper fruitMapper;

    @Override
    public boolean insertSelective(Fruit fruit) {
        return fruitMapper.insertSelective(fruit)>0;
    }

    @Override
    public boolean updateSelectiveById(Fruit fruit) {
        return fruitMapper.updateSelectiveById(fruit) >0;
    }

    @Override
    public boolean deleteByFid(Integer fid) {
        return fruitMapper.deleteByFid(fid);
    }

    @Override
    public List<Fruit> selectByFid(Integer fid) {
        return fruitMapper.selectByFid(fid);
    }


    @Override
    public List<Fruit> searchAll() {
        return fruitMapper.searchAll();
    }



    @Override
    public IPage<Fruit> getPage(int currentPage, int pageSize, Fruit fruit) {
        IPage page = new Page(currentPage,pageSize);
        fruitMapper.selectPage(page,null);
        return page;
    }
}




